<?
$val_string="";
$val_string2="";
include_once("includes/common_public_inc.php");
updateExpireAds("0");

if ($set_google_generate)
{
	$writeStr="";	  
	if ($set_validation == 1) { $val_string2 = " where ad_is_validated = 1 AND ad_is_validated = 1"; } else { $val_string2 = " AND ad_is_validated = 1"; } 
	$writeStr.="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">"; 
	
	$sql_links = "select ad_id from $ads_tbl $val_string2"; 
	$result = q ($sql_links); 
	
	while($row=mysql_fetch_array($result))
	{ 
		$ad_id = $row["ad_id"]; 
		$writeStr.="<url>\n"; 
		$writeStr.="<changefreq>weekly</changefreq>\n"; 
		$writeStr.="<loc>http://".$set_url."/" .linkDetail($ad_id)."</loc>\n"; 
		$writeStr.="</url>\n"; 
	}
	$writeStr.="\n</urlset>\n";
	
	$fp = fopen("images/google.xml","w+"); 
	fwrite($fp,$writeStr);
	fclose($fp);
}
addToHistory(18,"","",time());
?>
